package az.studio.gaokaowidget;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.text.Editable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Spinner;

public class GaokaoConf extends Activity
{
  protected static final int MENU_ABOUT = 1;
  private static final String PREFS_DATE = "date_";
  private static final String PREFS_NAME = "az.studio.gaokaowidget.GaokaoWidget";
  private static final String PREFS_POS = "bg_";
  private static final String PREFS_TYPE = "title_";
  private static final String TAG = "GaokaoConf";
  Button cancelButton;
  DatePicker datePicker;
  EditText etType;
  int mAppWidgetId = 0;
  String selectedPos;
  Spinner spinner;
  Button submitButton;
  View.OnClickListener submitOnClickListener = new View.OnClickListener()
  {
    public void onClick(View paramView)
    {
      GaokaoConf localGaokaoConf = GaokaoConf.this;
      String str1 = GaokaoConf.this.etType.getText().toString();
      String str2 = GaokaoConf.this.datePicker.getYear() + "-" + (1 + GaokaoConf.this.datePicker.getMonth()) + "-" + GaokaoConf.this.datePicker.getDayOfMonth();
      GaokaoConf.savePref(localGaokaoConf, GaokaoConf.this.mAppWidgetId, str1, str2, GaokaoConf.this.selectedPos);
      GaokaoWidget.updateAppWidget(localGaokaoConf, AppWidgetManager.getInstance(localGaokaoConf), GaokaoConf.this.mAppWidgetId);
      Intent localIntent = new Intent();
      localIntent.putExtra("appWidgetId", GaokaoConf.this.mAppWidgetId);
      GaokaoConf.this.setResult(-1, localIntent);
      GaokaoConf.this.finish();
    }
  };
  ImageButton typeButton;
  View.OnClickListener typeOnClickListener = new View.OnClickListener()
  {
    public void onClick(View paramView)
    {
      AlertDialog.Builder localBuilder = new AlertDialog.Builder(GaokaoConf.this);
      localBuilder.setTitle(2131034116);
    //  localBuilder.setItems(2131099648, new 1(this));
      localBuilder.create().show();
    }
  };

  private void init()
  {
    this.etType = ((EditText)findViewById(2131165187));
    this.typeButton = ((ImageButton)findViewById(2131165188));
    this.typeButton.setOnClickListener(this.typeOnClickListener);
    this.datePicker = ((DatePicker)findViewById(2131165190));
    this.submitButton = ((Button)findViewById(2131165194));
    this.submitButton.setOnClickListener(this.submitOnClickListener);
    this.cancelButton = ((Button)findViewById(2131165195));
    this.cancelButton.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramView)
      {
        GaokaoConf.this.finish();
      }
    });
    this.spinner = ((Spinner)findViewById(2131165192));
    ArrayAdapter localArrayAdapter = ArrayAdapter.createFromResource(this, 2131099650, 17367048);
    localArrayAdapter.setDropDownViewResource(17367049);
    this.spinner.setAdapter(localArrayAdapter);
    this.spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());
  }

  static String[] loadPref(Context paramContext, int paramInt)
  {
    String[] arrayOfString = new String[3];
    SharedPreferences localSharedPreferences = paramContext.getSharedPreferences("az.studio.gaokaowidget.GaokaoWidget", 0);
    String str1 = localSharedPreferences.getString("title_" + paramInt, null);
    if (str1 != null)
     {
//      arrayOfString[0] = str1;
//      label48: String str2 = localSharedPreferences.getString("date_" + paramInt, null);
//      if (str2 == null)
//        break label132;
//      arrayOfString[1] = str2;
//      label83: String str3 = localSharedPreferences.getString("bg_" + paramInt, null);
//      if (str3 == null)
//        break label144;
//      arrayOfString[2] = str3;
    }
    while (true)
    {
      return arrayOfString;
//      arrayOfString[0] = paramContext.getString(2131034115);
//      //break label48:
//      label132: arrayOfString[1] = paramContext.getString(2131034119);
//     // break label83:
//      label144: arrayOfString[2] = "0";
    }
  }

  private void openAboutDialog()
  {
    Log.d("GaokaoConf", "open about dialog");
    View localView = LayoutInflater.from(this).inflate(2130903040, null);
    new AlertDialog.Builder(this).setIcon(2130837515).setTitle(2131034121).setView(localView).setPositiveButton(17039370, null).show();
  }

  static void savePref(Context paramContext, int paramInt, String paramString1, String paramString2, String paramString3)
  {
    SharedPreferences.Editor localEditor = paramContext.getSharedPreferences("az.studio.gaokaowidget.GaokaoWidget", 0).edit();
    localEditor.putString("title_" + paramInt, paramString1);
    localEditor.putString("date_" + paramInt, paramString2);
    localEditor.putString("bg_" + paramInt, paramString3);
    localEditor.commit();
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setResult(0);
    setContentView(2130903041);
    init();
    Bundle localBundle = getIntent().getExtras();
    if (localBundle != null)
      this.mAppWidgetId = localBundle.getInt("appWidgetId", 0);
    if (this.mAppWidgetId == 0)
      finish();
    String[] arrayOfString1 = loadPref(this, this.mAppWidgetId);
    this.etType.setText(arrayOfString1[0]);
    String[] arrayOfString2 = arrayOfString1[1].split("-");
    int i = Integer.parseInt(arrayOfString2[0]);
    int j = Integer.parseInt(arrayOfString2[1]);
    int k = Integer.parseInt(arrayOfString2[2]);
    if (GaokaoWidget.getUntilDays(i, j, k) < 0L);
    this.datePicker.updateDate(++i, j - 1, k);
    this.selectedPos = arrayOfString1[2];
    this.spinner.setSelection(Integer.parseInt(this.selectedPos));
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    super.onCreateOptionsMenu(paramMenu);
    Log.d("GaokaoConf", "open Menu");
    paramMenu.add(0, 1, 0, 2131034121);
    return true;
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    Log.d("GaokaoConf", "select Menu Item");
    switch (paramMenuItem.getItemId())
    {
    default:
    case 1:
    }
    while (true)
    {
      return super.onOptionsItemSelected(paramMenuItem);
//      openAboutDialog();
    }
  }

  public class MyOnItemSelectedListener
    implements AdapterView.OnItemSelectedListener
  {
    public void onItemSelected(AdapterView<?> paramAdapterView, View paramView, int paramInt, long paramLong)
    {
      GaokaoConf.this.selectedPos = String.valueOf(paramInt);
    }

    public void onNothingSelected(AdapterView<?> paramAdapterView)
    {
    }
  }
}

/* Location:           E:\Desktop\Android\考试倒计时.apk\classes_dex2jar.jar
 * Qualified Name:     az.studio.gaokaowidget.GaokaoConf
 * JD-Core Version:    0.5.3
 */